/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class trg_ReceiptObject_Test {

    static testMethod void myUnitTest() 
    {
        // TO DO: implement unit test
        
        //Account Object Record...
        Account accountObject = new Account();
        accountObject.Name = 'Test Account';
        //accountObject.LicenseNumber__c = serialObject.id;
        accountObject.License_Application_Step__c = 'Record Created';
        accountObject.License_Application_Type__c = 'New License';
        accountObject.Activity__c = 'Trading - One Activity';
        accountObject.License_Issue_Date__c = system.today();
        accountObject.Master_Account_Flag__c = true;
        accountObject.License_Expiry_Date__c = System.Today().addYears(1);
        insert accountObject;
        
        Invoice__c invoiceObject = new Invoice__c();
        invoiceObject.Account__c = accountObject.id;
        invoiceObject.Date__c = System.Today();
        invoiceObject.Fee_Application_Type__c = 'New License';
        invoiceObject.Invoice_Type__c = 'New License';
        //Adding in the list...
        insert invoiceObject;
        
        //For Receipt Object Records...
        Receipt__c receiptObject = new Receipt__c();
        receiptObject.Company__c = accountObject.id;
        receiptObject.Total_Amount_on_Invoice__c = invoiceObject.Total_Invoice_Formula_Field__c;
        receiptObject.Receipt_Type__c = invoiceObject.Invoice_Type__c;
        receiptObject.Related_Invoice__c = invoiceObject.Id;
        receiptObject.Date__c = System.Today();
        receiptObject.Cancellation_Reason__c = 'Test';
        receiptObject.is_Cancelled_Receipt__c = true;
        insert receiptObject;
        
        Receipt__c receiptObject1 = new Receipt__c();
        receiptObject1.Company__c = accountObject.id;
        receiptObject1.Total_Amount_on_Invoice__c = invoiceObject.Total_Invoice_Formula_Field__c;
        receiptObject1.Receipt_Type__c = invoiceObject.Invoice_Type__c;
        receiptObject1.Related_Invoice__c = invoiceObject.Id;
        receiptObject1.Date__c = System.Today();
        insert receiptObject1;
        
        receiptObject1.Cancellation_Reason__c = 'Test';
        receiptObject1.is_Cancelled_Receipt__c = true;
        update receiptObject1; 
        
    }
}